<template>
  <div>
    <basic-container>
      <div class="banner-text">
         <div class="lettertop">
           <el-row>
          <el-col :span="8">
             <div class="letterSX">
               <span>银行分行</span>
                <!-- <el-input
                placeholder="请输入银行分行"
                v-model="name">
                </el-input> -->
                  <el-select v-model="name" @change="provinces()" placeholder="请选择">
                  <el-option
                    v-for="item in tableDictItemData"
                    :key="item.label"
                    :label="item.label"
                    :value="item.value+','+item.label">
                  </el-option>
                </el-select>
             </div>
          </el-col>
          <el-col :span="8"><div class="letterSX">
               <span>区域</span>
                <!-- <el-input
                placeholder="请输入省/市/区"
                v-model="id">
                </el-input> -->
               <el-select v-model="communityProvince" class="el-selectxx" @change="province()" placeholder="请选择">
                  <el-option
                    v-for="item in ProvinceList"
                    :key="item.areaCode"
                    :label="item.areaName"
                    :value="item.areaCode">
                  </el-option>
                </el-select>
                <el-select v-model="communityCity" class="el-selectxx" @change="City()" placeholder="请选择">
                  <el-option
                    v-for="item in CityList"
                    :key="item.areaCode"
                    :label="item.areaName"
                    :value="item.areaCode">
                  </el-option>
                </el-select>
                <el-select v-model="communityCounty" class="el-selectxx"   placeholder="请选择">
                  <el-option
                    v-for="item in CountyList"
                    :key="item.areaCode"
                    :label="item.areaName"
                    :value="item.areaCode">
                  </el-option>
                </el-select>
             </div></el-col>
          <el-col :span="8"><div class="letterSX">
               <span>小区名称</span>
                <el-input
                placeholder="请输入小区名称"
                v-model.trim="xqmc">
                </el-input>
             </div></el-col>
        </el-row>
         </div>
        <div class="lettertop"><el-row>
          <el-col :span="8"><div class="letterSX"></div></el-col>
          <el-col :span="8"><div class="letterSX">
            <el-button
                class="filter-item"
                type="primary"
                size="medium"
                icon="el-icon-search"
                @click="handleCreate()">查询
              </el-button>
              <el-button
                class="filter-item"
                type="primary"
                size="medium"
                icon="el-icon-delete"
                @click="handleCreaterror()">重置
              </el-button></div></el-col>
          <el-col :span="8"><div class="letterSX"></div></el-col>
          </el-row></div>
          <div>
              <div class="letteright" style="margin-bottom:20px;">
                 
                  <!-- <el-button
                class="filter-item"
                type="primary"
                size="medium"
                icon="el-icon-plus"
                @click="lettersuccbtn">批量添加
              </el-button> -->
                  <el-button
                class="filter-item"
                type="primary"
                size="medium"
                icon="el-icon-plus"
                @click="lettersuccbtn()">新增项目
              </el-button>
              </div>
            <el-table
              :data="tableData"
              border
              style="width: 100%">
              
              <el-table-column
                prop="bankBranches"
                label="分行名称"
                width="180">
              </el-table-column>
              <el-table-column
                prop="address"
                label="区域">
                <template slot-scope="scope">
                      {{scope.row.communityProvince}}{{scope.row.communityCity}}{{scope.row.communityCounty}}
                  </template>
              </el-table-column>
              <el-table-column
                prop="realEstateBranch"
                label="广汇房地产分公司">
              </el-table-column>
              <el-table-column
                prop="communityName"
                label="小区名称">
              </el-table-column>
              <el-table-column
                prop="communityAddress"
                label="小区地址">
              </el-table-column>
              <el-table-column
                prop="parkSpaceSum"
                label="小区车位数(个)">
              </el-table-column>
              <!-- <el-table-column
                prop="timer"
                label="在租数">
              </el-table-column>
               <el-table-column
                prop="timer"
                label="未租数">
              </el-table-column>
               <el-table-column
                prop="timer"
                label="锁定数（流程中）">
              </el-table-column> -->
              <el-table-column
                label="操作"
                width="180">
                <template slot-scope="scope">
                    <el-button @click="handleClick(scope,'CK')" type="text" size="small">查看</el-button>
                  </template>
              </el-table-column>
            </el-table>

            <el-pagination
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"
              :current-page="pageNum"
              :page-sizes="[10, 20, 30, 40]"
              :page-size="100"
              layout="total, sizes, prev, pager, next, jumper"
              :total='total'>
            </el-pagination>
          </div>
      </div>
      
    </basic-container>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
 import {getAllProject,getAllProvinceList,getChildByareaCode} from '@/api/cpls/cpls'
   import { fetchItemList} from '@/api/admin/dict'
export default {
  name: 'projectregistration',
  data() {
    return {
           
      ProvinceList:[],
      CityList:[],
      CountyList:[],
      activeNames: ['1', '2', '3', '4'],
      DATA: [],
      text: '',
      actor: '',
      count: 0,
      isText: false,
      name:null,
      communityProvince:null,
      bankBranchesCode:null,
      bankBranches:null,
      communityCity:null,
      communityCounty:null,
      xqmc:null,
      tableData: [],
      value: [],
      pageNum:1,
      pageSize:10,
      total:0,
      tableDictItemData:[]
    }
  },
  computed: {
    ...mapGetters(['website'])
  },
 
  created(){
    this.letterguaranList(this.pageNum,this.pageSize)
    this.getProvinceList()
  },
  methods: {
   handleClick(scope,status){
         this.$router.push({ path: '/project/seeProjectre',query:{id:scope.row.loanProjectId} })
      console.log()
   },
   lettersuccbtn(){
       this.$router.push({ path: '/project/newProjectre' })
   },
   handleCreate(){
      this.letterguaranList(this.pageNum,this.pageSize)
   },
     handleCreaterror(){
       this.name=null;
       this.ProvinceList=[]
       this.CityList=[]
      this.CountyList=[]
      this.communityCity=null
      this.communityCounty=null
      this.communityProvince=null
       this.xqmc=null;
       this.bankBranches=null;
       this.bankBranchesCode=null;
    this.letterguaranList(this.pageNum,this.pageSize)
    this.getProvinceList()
   },
    letterguaranList(pageNum,pageSize){
    
       getAllProject({
        "bankBranches": this.bankBranches,
        "bankBranchesCode":this.bankBranchesCode,
        "communityCity": this.communityCity,
        "communityCounty": this.communityCounty,
        "communityName": this.xqmc==''? null:this.xqmc,
        "communityProvince": this.communityProvince,//communityProvince,
        "countSql": true,
        "pageNum": pageNum,
        "pageSize": pageSize
       

      }).then(response => {
         
           
          this.tableData = response.data.data.list
          this.total=response.data.data.total
        })
   },
    handleSizeChange(val) {
        this.pageSize=val
         this.letterguaranList(this.pageNum,this.pageSize)
      },
      handleCurrentChange(val) {
        this.pageNum=val
        this.letterguaranList(this.pageNum,this.pageSize)
      },
   getProvinceList(){
      getAllProvinceList({
        
      }).then(response => {
    
          this.ProvinceList=response.data.data
      
        })
        fetchItemList(Object.assign({
          current: 1,
          size: 20
        }, {dictId: 195})).then(response => {
          this.tableDictItemData = response.data.data.records
        })
   },
   provinces(){
     this.bankBranchesCode=this.name.split(',')[0]
     this.bankBranches=this.name.split(',')[1]
   },
   province(){
    
      getChildByareaCode({
             areaCode:this.communityProvince
            }).then(response => {
         
            this.CityList=response.data.data
        
          })
   },City(){
      getChildByareaCode({
             areaCode:this.communityCity
            }).then(response => {
         
            this.CountyList=response.data.data
        
          })
   },
    
    handleChange(value) {
        console.log(value);
    }
  }
}
</script>

<style scoped="scoped" lang="scss">
  .wel-contailer {
    position: relative;
  }

  .banner-text {
    position: relative;
    padding: 0 20px;
    font-size: 20px;
    text-align: center;
    color: #333;
  }
  .lettertop{
    margin-bottom: 20px;
  }
  .letterbottom{
    text-align: center;
  }
  .el-button--small{
    font-size: 14px;
  }
  td,tr{
    div{
      text-align: center;
    }
  }
  .letteright{
      text-align: right;
  }
  .letterdowimg{
      span{
         width: 120px;
         border-radius: 10px;
         border:1px solid #ccc;
         display: inline-block;
         height: 90px;
      }
  }
  .maskMenu {
  position: fixed;
  width: 100%;
  height: 100%;
  z-index: 999;
  background: rgba(0, 0, 0, 1);
  opacity: 0.4;
  top: 64px;
  left: 0;
}
  .pull_menu{
          width: 700px;
    height: auto;
    background: #fff;
    position: fixed;
    z-index: 1000;
    left: 50%;
    top: 50%;
    margin-top: -200px;
    padding:  20px;
    border-radius: 10px;
    margin-left: -350px;
  }
  .lettersuccbtn{
        display: inline-block;
        background: deepskyblue;
        color: #fff;
        border-radius: 10px;
        padding: 5px 35px;
        margin: 10px;
        cursor: pointer;
            font-size: 16px;
      }
      .letterorbtn{
        display: inline-block;
        border: 1px solid #ccc;
        border-radius: 10px;
        padding: 5px 35px;
        margin: 10px;
        cursor: pointer;
            font-size: 16px;
      }
  .letterSX{
    span{
          display: inline-block;
         line-height: 43px; 
        padding: 0px 10px;
            font-size: 16px;
      }
      .el-selectxx{
        width: 100px;
      }
     .el-input,.el-cascader{
       width: 300px;
     }
  }

  // .banner-img {
  //   position: absolute;
  //   top: 0;
  //   left: 0;
  //   width: 100%;
  //   height: 100%;
  //   opacity: 0.8;
  //   display: none;
  // }

  // .actor {
  //   height: 250px;
  //   overflow: hidden;
  //   font-size: 18px;
  //   color: #333;
  // }

  // .actor:after {
  //   content: '';
  //   width: 3px;
  //   height: 25px;
  //   vertical-align: -5px;
  //   margin-left: 5px;
  //   background-color: #333;
  //   display: inline-block;
  //   animation: blink 0.4s infinite alternate;
  // }

  .typeing:after {
    animation: none;
  }

  @keyframes blink {
    to {
      opacity: 0;
    }
  }
</style>
